class CommentsController < ApplicationController
    def create
        @comment = Comment.new(params[:comment].permit(:content))
        if @comment.save
            User.find(session[:user_id]).comments.push(@comment)
            Post.find(params[:post_id]).comments.push(@comment)
        end
        redirect_to blog_path(params[:blog_id])
    end

    def destroy
        @comment = Comment.find(params[:id])
        @comment.destroy
        redirect_to blog_path(params[:blog_id])
    end
end
